package com.mogu.blogs.config;

/**
 * Created by 45795 on 2020/5/27.
 */
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102300747524";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCtnDpQqbNiZleOYN2fUn8TdZd3hGsapYyKXvfMOJ/imuGAEr4CP7oqzZedMPQQNxfgMlmRdpUTAL0WUukpcobvOKbkBYyOUPCvj44GzRhTxM78bAt64MKvhy8gtwM/Fe4dyeY+M6FMvTLSVAHpMy97p2BP1kyWZI3TloNpYynydGdp81Ygy5hPYFqu2ObFHVJeJjIFQHwXsn38Syq5BA7UJW7tXCJ/KvexIGRbXcQiNkEQlV+lNXsbF+j+WpCixZB2VmQB+jW8ccauZh6Bm5a3vO/5NslEWr2vUpGY95CSLvidyD2h4rZBbjIHIPyvDgu0ryvAMrKPntpBz2l3obvBAgMBAAECggEAZjn95I1ogWJ93+qN1UjAZvbxD4E7h98/WCL/ipM1IjvM2JswoyZfOuEAi6DNtdabCnrbXtoSgbQHo2OCw9MaPTaAnvfdgdeLQfUnzj1qO7lBoEUGpX4/ZRgW2g6prLX/Fi9SkgHY0tT9Xff1gBmRtiAiiCBJzKy9DoAsNRwdERQbWP+7QOliTBqtgBiSYSTKITns0hWwTm/Jy6dBM2srJo+DsVjAbaEQK/bPzpQgpM8EA54VfA5Og5M4YkBEx82WPpVdFxAkOcpzb+FHD+BiPQjUehp4EhtbGZWLAfiGUZs4AiHZdU9wupRSWFDNTE93hn+IvyqTyCscl4bjvaJ3eQKBgQDxcDf97xh0vBLnjK/wQ/1et95yhWW+c4DRvzsK35XBrq+IhDIq/XvIKlOyH9AqYju8L7babs5ZvEYyK0OkPpGmbk0KvXoUFo+akXqABL2x/eQ44wsJzIpNZ0LM1IkEQWi25H8hMdUfQj4Ofh52UefoJErd1XxoXKKXRa5RkMgm5wKBgQC4FMA9FYBvY+4wvJ828orhf825jjGFqgf79FleoKfusgpghVdvyfTvaQidVw62rjclnLnJwKCCYm4FYtPLm0LhO9l0W3w44VF3f22fdj/3qa3uHWHaNjxgYWzWZz4h5QEMZFjIbqrTLc3AtpcLv/LH4nIHNW1I5Nv9Vqvg0vk7FwKBgBg2FKdWTrGGGq81oH8LkmDpN1lsnyNWGdjuwFD60t21Uszx1MYS3VLZS8NVBV76strQPhnxeqftBW0KgaH61EhIT1mAXrmc+ZGafRpRX2R1/Wjm+7hj1oqkjEJWHddbZ9DPYSBHCwQzdF2nsA5VcFgLK6bLPcqJX5Sj3DM5vZiJAoGBAKgZUv+1Decqo03gQaiEzmxkMDKddf2wqr/bgG0YWqJv9Wf0/Ea6bzDdgp9j66zI5NU1DLf/btQCHKRQfkZ1Txqtc8N887Bhmep89FdlPb7lNU63iC8jzfjZnvEfsK51GIL/c8/8t4RHVJgCZWa2b3c3A5gvos+pJndvWV/iaPQbAoGABqriC2l5Rky6zrDbj03eB3ZmOY5g4aQpK5jxmOjLz0H6wv6AUTpNqcLAEjJOqwAficByjVXXZikPrHBGlBTIEQH1wv0JcInG01SMAdmUFfFImPUbORQ01aZ/ss1vhGR0evdkOB42yEjdElTeeVGG+1PNOYBQvlUUDbfmfjBQofs=";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArZw6UKmzYmZXjmDdn1J/E3WXd4RrGqWMil73zDif4prhgBK+Aj+6Ks2XnTD0EDcX4DJZkXaVEwC9FlLpKXKG7zim5AWMjlDwr4+OBs0YU8TO/GwLeuDCr4cvILcDPxXuHcnmPjOhTL0y0lQB6TMve6dgT9ZMlmSN05aDaWMp8nRnafNWIMuYT2BartjmxR1SXiYyBUB8F7J9/EsquQQO1CVu7Vwifyr3sSBkW13EIjZBEJVfpTV7Gxfo/lqQosWQdlZkAfo1vHHGrmYegZuWt7zv+TbJRFq9r1KRmPeQki74ncg9oeK2QW4yByD8rw4LtK8rwDKyj57aQc9pd6G7wQIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String notify_url = "http://localhost:8080/pay/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String return_url = "http://localhost:8080/pay/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}